package com.azxc.rapid.system.user.mapper;

import com.azxc.rapid.system.user.vo.UserTreeVO;
import com.azxc.rapid.system.user.vo.UserVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;

import com.azxc.rapid.system.user.entity.User;
import com.azxc.rapid.system.user.excel.UserExcel;

import java.util.Collection;
import java.util.List;

/**
 * Mapper 接口
 *
 *
 */
public interface UserMapper extends BaseMapper<User> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param user
	 * @param deptId
	 * @param tenantId
	 * @return
	 */
	List<User> selectUserPage(IPage<User> page, @Param("user") User user, @Param("deptId") Long deptId, @Param("tenantId") String tenantId);

	/**
	 * 获取用户
	 *
	 * @param tenantId
	 * @param account
	 * @return
	 */
	User getUser(String tenantId, String account);

	/**
	 * 获取导出用户数据
	 *
	 * @param queryWrapper
	 * @return
	 */
	List<UserExcel> exportUser(@Param("ew") Wrapper<User> queryWrapper);

	UserVO getUserVoInfo(@Param("userId") String userId);

	List<UserTreeVO> deptAllTree();

	List<UserTreeVO> deptTree(Long deptId);

	List<User> selectUserByDept(@Param("deptId") String deptId);

	List<User> selectUserByName(@Param("search") String search);

	List<User> selectUserByPhone(@Param("search") String search);

	List<UserTreeVO> allTree();

	List<UserTreeVO> tree(long deptId);

	List<String> selectUserByRoleId(@Param("roleId")Long roleId,@Param("regionCode")String regionCode);

	/**
	 * 获取用户
	 *
	 * @param tenantId
	 * @param phone
	 * @return
	 */
	User getUserByPhone(String tenantId, String phone);
}
